#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

using ll = long long;
using db = double;
using vec = vector<int>;
using pii = pair<int,int>;

int read() {
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar();
	return f ? -x : x;
}

const int N = 1e5 + 10;

int l[N],r[N],L[N],R[N],n,b[N << 1],op[N],tot,fa[N],cnt;

int pos(int x) { return lower_bound(b + 1,b + tot + 1,x) - b; }

int gf(int x) { return fa[x] == x ? x : fa[x] = gf(fa[x]); }

namespace st {
	vec val[N << 3];
	void upd(int pos,int x,int o = 1,int l = 1,int r = tot) {
		for(auto y : val[o]) {
			y = gf(y); fa[y] = x; L[x] = min(L[y],L[x]); R[x] = max(R[x],R[y]);
		} if(val[o].size()) val[o].clear(), val[o].pb(x); if(l == r) return; int mid = l + r >> 1;
		if(pos <= mid) upd(pos,x,o << 1,l,mid); else upd(pos,x,o << 1 | 1,mid + 1,r);
	}
	void put(int xl,int xr,int x,int o = 1,int l = 1,int r = tot) {
		if(xl == l && xr == r) return val[o].pb(x); int mid = l + r >> 1;
		if(xr <= mid) put(xl,xr,x,o << 1,l,mid); else if(xl > mid) put(xl,xr,x,o << 1 | 1,mid + 1,r);
		else put(xl,mid,x,o << 1,l,mid) , put(mid + 1,xr,x,o << 1 | 1,mid + 1,r);
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;for(int i = 1;i <= n;i++) fa[i] = i;
	for(int i = 1;i <= n;i++) op[i] = in,b[++tot] = l[i] = in,b[++tot] = r[i] = in;
	sort(b + 1,b + tot + 1); tot = unique(b + 1,b + tot + 1) - b - 1;
	for(int i = 1;i <= n;i++)
		if(op[i] == 1){
			l[i] = pos(l[i]); r[i] = pos(r[i]); ++cnt; L[cnt] = l[i]; R[cnt] = r[i];
			st :: upd(l[i],cnt); st :: upd(r[i],cnt); if(l[i] +  1 <= r[i] - 1) st :: put(l[i] + 1,r[i] - 1,cnt);
		} else {
			int u = gf(l[i]),v = gf(r[i]);
			puts(u == v || L[u] > L[v] && L[u] < R[v] || R[u] > L[v] && R[u] < R[v] ? "YES" : "NO");
		}
	return 0;
}
